package com.example.springblog.service;

import com.example.springblog.mapper.BlogMapper;
import com.example.springblog.model.BlogInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BlogService {
    @Autowired
    BlogMapper blogMapper;

    public List<BlogInfo> getList() {
        return blogMapper.selectAll();
    }

    public BlogInfo getBlogDetail(Integer blogId) {
        return blogMapper.selectById(blogId);
    }

    public Boolean insertBlog(BlogInfo blogInfo) {
        return blogMapper.insertBlog(blogInfo) == 1;
    }

    public void update(BlogInfo blogInfo) {
        blogMapper.updateBlog(blogInfo);
    }
}
